<template>
  <a-card :bordered="false">
    <!-- 查询区域 -->
    <search ref='search' :config='searchConfig' @search='search' @getHeight='getHeight' />
    <!-- table区域-begin -->
      <vxe-grid
        ref='xGrid'
        v-bind='vexConfig'
        :align='left'
        :border='true'
        :checkbox-config="checkboxConfig"
        :columns='columns'
        :data='dataSource'
        :height='pageHeight-seachHeight-94'
        :loading='loading'
        :resizable='true'
        :showOverflow='true'
        :toolbar-config="tableToolbar"
        size='mini'
        @checkbox-change='selectChangeEvent'
        @checkbox-all="selectChangeEvent"
      >
        <template  #action='{ row,rowIndex }'>
<!--          <a v-has="'getGoodsAdress:update'" @click='handleEdit(row)'>编辑</a>-->
<!--          <a-divider type='vertical' />-->
          <a-dropdown>
            <a class='ant-dropdown-link'>更多
              <a-icon type='down' />
            </a>
            <a-menu slot='overlay'>
              <a-menu-item>
                <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(row.id)">
                  <a>删除</a>
                </a-popconfirm>
              </a-menu-item>
            </a-menu>
          </a-dropdown>
        </template>
        <template #pager>
          <vxe-pager
            :currentPage.sync='ipagination.current'
            :layouts="['Total', 'PrevJump', 'PrevPage', 'Number', 'NextPage', 'NextJump','Sizes', 'FullJump']"
            :page-size.sync='ipagination.pageSize'
            :pageSizes='ipagination.pageSizeOptions'
            :total='ipagination.total'
            @page-change='handlePageChange'>
          </vxe-pager>
        </template>
      </vxe-grid>
    <!-- table区域-end -->

    <!-- 表单区域 -->
    <newAdd ref="modalForm" @ok="modalFormOk"></newAdd>

  </a-card>
</template>

<script>
import newAdd from './modules/newAdd'
import JSuperQuery from '@/components/cn-form/JSuperQuery.vue';
import JInput from '@/components/cn-form/JInput.vue';
import {initDictOptions, filterDictText,filterDictTextByCache} from '@/components/dict/CnDictSelectUtil'
import { PageListMixin } from '@/mixins/PageListMixin'
import Vue from 'vue'
import { filterObj } from '@/utils/util';
import JTreeSelect from '@/components/cn-form/JTreeSelect'
import { postAction } from '../../../api/manage'
//高级查询modal需要参数
const superQueryFieldList=[
  {
    type: "string",
    value: "name",
    text: "用户名"
  }, {
    type: "int",
    value: "age",
    text: "年龄"
  }, {
    type: "date",
    value: "birthday",
    text: "生日"
  }
]
export default {
  name: "customerBuy",
  mixins:[PageListMixin],
  components: {
    JSuperQuery,
    JInput,
    JTreeSelect,
    newAdd,
  },
  data() {
    return {
      description: '经销商可购清单',
      //字典数组缓存
      sexDictOptions: [],
      //搜索区域
      searchConfig: [
        {
          type: 'input',
          name: 'code',
          placeholder: '请输入组织编号'
        },
        {
          type: 'input',
          name: 'name',
          placeholder: '请输入组织名称'
        },
        {
          type: 'input',
          name: 'productCode',
          placeholder: '请输入商品编号'
        },
        {
          type: 'input',
          name: 'productName',
          placeholder: '请输入商品名称'
        },
      ],
      importExcelUrl:`${window._CONFIG['domianURL']}/test/cn-formDemo/importExcel`,
      ////表头
      columns: [
        {
          width:60,
          fixed: 'left',
          type:'checkbox',
        },
        {
          title: '规则编号',
          minWidth:80,
          field: 'ruleCode',
        },
        {
          title: '经销商编号',
          minWidth:80,
          field: 'code',
        },
        {
          title: '经销商名称',
          minWidth:80,
          field: 'name'
        },
        {
          title: '商品编号',
          minWidth:80,
          field: 'productCode'
        },
        {
          title: '商品名称',
          minWidth:80,
          field: 'productName',
        },
        {
          title: '创建人',
          minWidth:80,
          field: 'createName'
        },
        {
          title: '创建时间',
          minWidth:80,
          field: 'createTime'
        },
        {
          title: '操作',
          field: 'action',
          width: 120,
          minWidth:80,
          fixed:'right',
          slots: { default: 'action' },
        }
      ],
      url: {
        list:  window._CONFIG['domianDmsURL'] + "/custProduct/findPageListClient",
        delete:  window._CONFIG['domianDmsURL'] + "/custProduct/deleteByIdClient",
        deleteBatch: "/test/cn-formDemo/deleteBatch",
        exportXlsUrl: "/test/cn-formDemo/exportXls"
      },
      fieldList:superQueryFieldList
    }
  },
  created() {
  },
  methods: {},


}
</script>
<style scoped>
@import '~@assets/less/common.less';
</style>